﻿package vklib.gui 
{
	import flash.display.DisplayObject
	import flash.display.DisplayObjectContainer;
	import flash.utils.IDataInput;
	import vklib.VkApi;
	import flash.display.Sprite
	/**
	 * ...
	 * @author apisoc@gmail.com
	 */
	public class GuiMenu 
	{
		private var _impl:*;
		
		//public override function get parent() : DisplayObjectContainer  { return _impl; }
		
		public function toGui():DisplayObject { return _impl; }
		
		public function GuiMenu(name:String)
		{
			_impl = VkApi.instance.load(name.length ? name : 'Gui.Menu.Default');
				
			/*
			_impl = VkApi.instance.load(name.length ? name : 'Gui.Menu.Default');
			if ('Gui.Menu.Default' == name) {
				_impl.addItem('Test', 'TestPage');
				//_impl.addItem('12', 'Add');
			}
			
//			_impl.parent.addChild(_impl);
			*/
		}
		
		public function addItem(item:String, name:String):void
		{
			//addXmlItem( { title: item, location: name } );
			_impl.addItem(item, name);
		}
		
		public function addXmlItem(item:XML):void
		{
			for each (var item:XML in item.elements()) {
				_impl.addItem(item.title, item.location);
			}
			
		}
		//public function addItem(item:XML):void
	}

}